window.onload = function () {
    var mydiv = document.getElementById('mydiv');
    var colors = ['pink', 'lightblue', 'lightgreen', 'gold', 'plum'];
    var i = 0;
    setInterval(function () {
        mydiv.style.backgroundColor = colors[i++ % colors.length];
    }, 1000);
};
